//
//  YSSummaryCell.m
//  YReaderDemo
//
//  Created by MOLBASE on 2018/11/8.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "YSSummaryCell.h"
#import "YSBookSummaryModel.h"
#import "YSReadHelper.h"

@interface YSSummaryCell ()

@property (weak, nonatomic) IBOutlet UILabel *summaryLabel;
@property (weak, nonatomic) IBOutlet UILabel *summaryNumaLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *selectLabel;
@property (weak, nonatomic) IBOutlet UIImageView *bgImageV;


@end

@implementation YSSummaryCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.bgImageV.image = [YSReadHelper imageWithColor:[UIColor colorWithRed:98/255 green:98/255 blue:98/255 alpha:1] size:self.bgImageV.bounds.size];
    self.bgImageV.layer.cornerRadius = self.bgImageV.bounds.size.width/2;
}

- (void)setIsSelectSummary:(BOOL)isSelectSummary {
    _isSelectSummary = isSelectSummary;
    self.selectLabel.hidden = !isSelectSummary;
}

- (void)setSummaryModel:(YSBookSummaryModel *)summaryModel {
    _summaryModel = summaryModel;
    if (summaryModel && summaryModel.source.length > 0) {
        self.summaryLabel.text = [summaryModel.source substringToIndex:1];
    }
    self.summaryNumaLabel.text = summaryModel.source;
    self.titleLabel.text = summaryModel.lastChapter;
    self.timeLabel.text = [YSReadHelper getUpdateStringWith:summaryModel.updated];
}

@end
